package com.hsjk.szwj.module.train.service.impl;

import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.train.controller.app.vo.knowledge.KnowledgeListBySetIdRespVO;
import com.hsjk.szwj.module.train.convert.KnowledgeConvert;
import com.hsjk.szwj.module.train.dal.dataobject.knowledge.KnowledgeDO;
import com.hsjk.szwj.module.train.dal.mysql.knowledge.IKnowledgeMapper;
import com.hsjk.szwj.module.train.service.IKnowledgeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/09/26 00:37
 **/
@Service
public class KnowledgeServiceImpl implements IKnowledgeService {
    @Resource
    private IKnowledgeMapper knowledgeMapper;

    @Override
    public List<KnowledgeListBySetIdRespVO> listKnowledgeBySetId(Long knowledgeSetId) {
        List<KnowledgeDO> knowledgeDOS = knowledgeMapper.selectList(new LambdaQueryWrapperX<KnowledgeDO>()
                .eq(KnowledgeDO::getKnowledgeSetId, knowledgeSetId));
        return KnowledgeConvert.INSTANCE.convertKnowledgeListBySetIdRespVO(knowledgeDOS);
    }
}
